<?php
/*
 * @Author: 李志刚
 * @CopyRight: 2020-2030 衡水山木枝技术服务有限公司
 * @Date: 2021-10-19 10:22:10
 * @Description: 订单支付记录，可能会关联多单，反向做关联
 * @LastEditors: 李志刚
 * @LastEditTime: 2021-10-20 08:36:08
 * @FilePath: /归档/base/2021_10_19_102210_create_order_pay.php
 */

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreatePay extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('order_pays', function (Blueprint $table) {
            $table->engine = 'InnoDB';
            $table->id();
            $table->foreignId('user_id')->default(0)->comment('支付用户');
            $table->char('pay_sn', 15)->comment('支付订单编号')->unique('pay_sn');
            $table->unsignedDecimal('total_prices')->default(0)->comment('支付金额');
            $table->unsignedDecimal('wx_money')->default(0)->comment('微信支付金额');
            $table->unsignedDecimal('yue_money')->default(0)->comment('余额支付金额');
            $table->tinyInteger('pay_status')->default(0)->comment('0未支付1支付中2支付完成');
            $table->tinyInteger('pay_type')->default(1)->comment('支付方式 1微信 2余额 3混合');
            $table->string('pay_name', 255)->nullable()->comment('不同方式拼接，如充值卡，微信，余额');
            $table->dateTime('pay_at')->default('2021-10-10 00:00:00')->comment('支付时间');
            $table->tinyInteger('type')->default(1)->comment('类型 1商品订单 2充值订单');
            $table->tinyInteger('del_flag')->default(0)->comment('删除状态（1删除 0正常）');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('order_pays');
    }
}
